<?php
/**
 * @Description 计算时间的工具类
 * @Author yulipu
 */
class Timer {                         
	private $startTime;                
	private $stopTime;                
	
	public function __construct() {            
		$this->startTime = 0;          
		$this->stopTime = 0;          
	}
		
	public function start() {                      
		$this->startTime = microtime(true);   
	}

	public function stop() {                      
		$this->stopTime = microtime(true);  
	}
	public function spent() {                      
		return round(($this->stopTime - $this->startTime), 4);  //计算后以4舍5入保留4位返回
	}
}
